<html>
    <head>
        <title>Micropython WebSocket Test</title>
        <script language="Javascript">

            function on_load() {

                document.getElementById("console").innerHTML += "started<BR/>";

                var conn = new WebSocket("ws://localhost");
                document.getElementById("console").innerHTML += "created socket<BR/>";

                conn.onopen = function () {
                    document.getElementById("console").innerHTML += "onopen: send ping<BR/>";
                    conn.send("ping");
                }

                conn.onerror = function (error) {
                   console.log("Websocket error: " + error);
                }

                conn.onmessage = function (msg) {
                    document.getElementById("console").innerHTML += "msg: "+msg.data+"<BR/>";    
                }

            }
            
        </script>
    </head>
    <body onload="on_load()">
        <DIV id="console">tester<BR/></DIV>
    </body>
</html>
